package pl.org.lutra.planner.gui.table;

import java.util.List;

import pl.org.lutra.planner.gui.resources.Text;
import pl.org.lutra.planner.model.data.DecoSegment;

public class DecoTableModel extends PlannerTableModel<DecoSegment> {
	private static final long serialVersionUID = 5567122229515514477L;

	@Override
	protected DecoColumn[] createColumns() {
		return new DecoColumn[] { DecoColumn.DEPTH, DecoColumn.TIME };
	}

	@Override
	public void setSegments(List<DecoSegment> segments) {
		super.setSegments(segments);
		fireTableDataChanged();
	}

	enum DecoColumn implements PlannerColumn<DecoSegment> {
		DEPTH("column.depth") {
			@Override
			public Object getValue(DecoSegment segment) {
				return segment.getDepth();
			}
		},
		TIME("column.time") {
			@Override
			public Object getValue(DecoSegment segment) {
				return segment.getTime();
			}
		};

		private String key;

		private DecoColumn(String key) {
			this.key = key;
		}

		@Override
		public String getLabel() {
			return Text.get(key);
		}
	}
}
